package uc108.com.jetpackdemo.room;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface UserDao {
    @Insert
    long insert(User user);

    @Delete
    int delete(User user);

    @Update()
    int update(User user);

    @Query("SELECT * FROM tcy_user where uid = :uid")
    User findUserById(int uid);

    @Query("DELETE from tcy_user")
    int deleteAll();

    @Insert
    void insert(List<User> users);

    @Query("select * from tcy_user")
    List<User> getAllUser();
}
